package com.qfjy.mapper;

import com.qfjy.entity.po.MeetingGrab;
import com.qfjy.entity.po.MeetingPub;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface MeetingGrabMapper {
    int deleteByPrimaryKey(String id);

    int insert(MeetingGrab record);

    int insertSelective(MeetingGrab record);

    MeetingGrab selectByPrimaryKey(String id);

    int updateByPrimaryKeySelective(MeetingGrab record);

    int updateByPrimaryKey(MeetingGrab record);
    /**
     * todo 会议发单-我的抢单列表
     */
    List<MeetingGrab> selectListMeetingGrabByUid(int uid);

    /**
     * 修改抢单未被选择成讲师的抢单状态
     * @param pid
     * @return
     */
    @Update("update meeting_grab set grab_status=2, grab_date=now() where pid=#{pid}")
    int updateMeetingGrabGrabStatusFail(String pid);

    /**
     * 修改抢单被选择成讲师的抢单状态
     * @param pid
     * @param uid
     * @return
     */
    @Update("update meeting_grab set grab_status=1, grab_date=now() where pid=#{pid} and uid=#{uid}")
    int updateMeetingGrabGrabStatusSuccess(String pid,int uid);
}
